// 2种方式定义一个数组（数组中的元素可以是任意类型）
var a;
var list = [1, 2, 3];
function fun(arr) {
    var a = 0;
    for (var i = 0; i < arr.length; i++) {
        a += arr[i];
    }
    console.log(a);
}
fun([2, 8, 9, 6, 5, 8, 7]);
function fun1(a) {
    if (Boolean(a)) {
        console.log(true);
    }
    else {
        console.log(false);
    }
}
fun1("nudefined");
function fun2(arr) {
    var a = [];
    for (var i = 0; i < arr.length; i++) {
        if (typeof (arr[i]) == "number") {
            a.push(arr[i] * 5);
        }
    }
    console.log(a);
}
fun2(["a", "c", 6, "e", 5, 3, "d"]);
function fun3(arr) {
    var a = [0];
    for (var i = 0; i < arr.length; i++) {
        a.push(arr[i]);
    }
    console.log(a);
}
fun3([1, 2, 3, 4, 5, 6]);
function bouncer(arr) {
    var a = [];
    for (var i = 0; i < arr.length; i++) {
        if (Boolean(arr[i])) {
            a.push(arr[i]);
        }
    }
    console.log(a);
}
bouncer([7, "", "qq", false, 9]);
function str(arr) {
    for (var i = 0; i < arr.length; i++) {
        for (var j = i + 1; j < arr.length; j++) {
            if (arr[i] == arr[j]) {
                console.log(arr[i]);
            }
        }
    }
}
str("2222222222222");
